The AddPenguinTwoConditionalActions routine adds logic to our penguin. Using this routine, you can transform the penguin into a two-state button that plays/pauses the movie.
We are relying on the fact that a GetVariable for a variableID which has never been set will return 0. If we need another default value, we could initialize it using the frameLoaded event.
A higher level description of the logic is:
On MouseUpInside
If (GetVariable(DefaultTrack, 1) = 0)
SetMovieRate(1)
SetSpriteGraphicsMode(DefaultSprite, { blend, grey } )
SetSpriteGraphicsMode(GetSpriteByID(DefaultTrack, 5), {
ditherCopy, white } )
SetVariable(DefaultTrack, 1, 1)
ElseIf (GetVariable(DefaultTrack, 1) = 1)
SetMovieRate(0)
SetSpriteGraphicsMode(DefaultSprite, { ditherCopy, white })
SetSpriteGraphicsMode(GetSpriteByID(DefaultTrack, 5), { blend,
grey })
SetVariable(DefaultTrack, 1, 0)
Endif
End
| Previous | Chapter Contents | Chapter Top | Next |